import Taro, {Component} from "@tarojs/taro";
import {View, RichText} from "@tarojs/components";
import {inject, observer} from '@tarojs/mobx'
import {IStoreProps} from '../../store/Stores'
import {companyName, getRuntime} from '../../utils/common'

import './serviceAgreement.less'

// 确认订单
interface IHomeProps extends IStoreProps {}

@inject("stores")
@observer
class ServiceAgreement extends Component<IHomeProps> {
  constructor(props) {
    super(props)
  }

  state = {
    info: {}
  }

  componentWillMount(): void {
    Taro.setNavigationBarTitle({ title:companyName+'服务协议' })
    this.getUserRegistAgreement()
  }


  getUserRegistAgreement() {
    let { homeStore } = this.props.stores
    homeStore.getServiceAgreement({
      callback: res => {
        this.setState({info: res})
      }
    })
  }

  render() {
    let { info } = this.state
    return (
      <View className='my-help-detail'>
        <View className='list-title'>{companyName}服务注册协议</View>
        <View className='article-wrap article rich-text'>
          <RichText nodes={info.content} />
        </View>
      </View>
    )
  }
}

export default ServiceAgreement
